package model.sales;
// Generated Feb 14, 2013 10:33:00 PM by Hibernate Tools 3.2.1.GA


import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.annotations.Cascade;

/**
 * TrsSalesMst generated by hbm2java
 */
@Entity
@Table(name="trs_sales_mst", schema="sales")
public class SalesMst  implements java.io.Serializable {

     private long id;
     private SalesInit salesInit;
     private String transNum;
     private Date transTime;
     private Integer memberId;
     private BigDecimal subtotal;
     private BigDecimal diskon;
     private BigDecimal ppn;
     private BigDecimal total;
     private String userName;
     private SalesPayment salesPayment;
     private List<SalesDetail> salesDetails;
     private List<SalesPromo> salesPromos;

    public SalesMst() {
    }
	
    @Id 
    @SequenceGenerator(name="sales_seq", sequenceName="sales.trs_sales_mst_id_seq", allocationSize=1)
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="sales_seq")
    @Column(name="id", unique=true, nullable=false)
    public long getId() {
        return this.id;
    }
    
    public void setId(long id) {
        this.id = id;
    }
    
    @ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="init_id")
    public SalesInit getSalesInit() {
        return this.salesInit;
    }
    
    public void setSalesInit(SalesInit salesInit) {
        this.salesInit = salesInit;
    }
    
    @Column(name="trans_num", length=30)
    public String getTransNum() {
        return this.transNum;
    }
    
    public void setTransNum(String transNum) {
        this.transNum = transNum;
    }
    @Temporal(TemporalType.TIME)
    @Column(name="trans_time", length=15)
    public Date getTransTime() {
        return this.transTime;
    }
    
    public void setTransTime(Date transTime) {
        this.transTime = transTime;
    }
    
    @Column(name="member_id")
    public Integer getMemberId() {
        return this.memberId;
    }
    
    public void setMemberId(Integer memberId) {
        this.memberId = memberId;
    }
    
    @Column(name="subtotal", precision=13)
    public BigDecimal getSubtotal() {
        return this.subtotal;
    }
    
    public void setSubtotal(BigDecimal subtotal) {
        this.subtotal = subtotal;
    }
    
    @Column(name="diskon", precision=13)
    public BigDecimal getDiskon() {
        return this.diskon;
    }
    
    public void setDiskon(BigDecimal diskon) {
        this.diskon = diskon;
    }
    
    @Column(name="ppn", precision=13)
    public BigDecimal getPpn() {
        return this.ppn;
    }
    
    public void setPpn(BigDecimal ppn) {
        this.ppn = ppn;
    }
    
    @Column(name="total", precision=13)
    public BigDecimal getTotal() {
        return this.total;
    }
    
    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    @OneToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="salesMst")
    public SalesPayment getSalesPayment() {
        return salesPayment;
    }

    public void setSalesPayment(SalesPayment salesPayment) {
        this.salesPayment = salesPayment;
    }
    
    @Column(name="user_name", length=50)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @OneToMany(cascade=CascadeType.ALL, fetch= FetchType.LAZY, mappedBy="salesMst")
    @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    @OrderBy("seq")
    public List<SalesDetail> getSalesDetails() {
        return salesDetails;
    }

    public void setSalesDetails(List<SalesDetail> salesDetails) {
        this.salesDetails = salesDetails;
    }

//    @OneToMany(cascade=CascadeType.ALL, mappedBy="salesMst")
//    @LazyCollection(LazyCollectionOption.FALSE)
//    @Fetch(value = FetchMode.SUBSELECT)
    @OneToMany(cascade=CascadeType.ALL, fetch= FetchType.LAZY, mappedBy="salesMst")
    @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    public List<SalesPromo> getSalesPromos() {
        return salesPromos;
    }

    public void setSalesPromos(List<SalesPromo> salesPromos) {
        this.salesPromos = salesPromos;
    }
    




}


